package com.game.config.redission;

import java.io.IOException;
import java.net.URL;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 
 * @author ZGame
 * redission配置初始
 *
 */
@Configuration
public class RedissionConfig {

	@Value("${redis.redisson.config}")
	private String redissionConfigPath;

	@Bean
	public RedissonClient redisson() throws IOException {
		URL url = RedissionConfig.class.getClassLoader().getResource(redissionConfigPath);
		Config config = Config.fromYAML(url);
		return Redisson.create(config);
	}
}
